import redis

#建立连接
try:
    pool = redis.ConnectionPool(host='192.168.209.200', port=6379, db=0, password=None,health_check_interval=30)
    r = redis.Redis(connection_pool=pool)
    r.ping()
except redis.RedisError as e:
    print("连结错误!",e)
#执行简单的字符串操作
r.set('name', 'apple')
print(r.get('name'))
r.close()
pool.close()